<?php
/* @var $this TrxReceiptController */
/* @var $model TrxReceipt */


$this->breadcrumbs=array(
	'Trx Receipts'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'List TrxReceipt', 'url'=>array('index')),
	array('label'=>'Create TrxReceipt', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#trx-receipt-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Receipt</h1>

<a href="<?php echo Yii::app()->createUrl('trxReceipt/create'); ?>" class="btn btn-sm btn-primary">Input Receipt</a><br /><br />

<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView',array(
	'itemsCssClass'=>'table table-hover table-striped table-bordered table-condensed',
	'id'=>'trx-receipt-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		array(
			'name'=>'no_receipt',
			//'value'=>'$data->no_receipt',
			'value' => '$data->posting == 2 ? $data->no_receipt : "" ',
		),
		array(
			'name'=>'client_name',
			'header'=>'Receipt From',
			'value' => '$data->client_name',
		),
		//'no_receipt',
		/*'nota_note',
		'coa_debet_id',
		'coa_credit_id',
		'nominal',
		'keterangan',
		
		'createdby',
		'createdtime',
		'updatedby',
		'updatedtime',
		'tgl_transaksi',
		'client_name',
		'mst_client_id',
		'sisa_bayar',
		'kurang_bayar',
		'no_nota_id',
		'jns_trx',
		'no_receipt',
		*/
		array(
                'class'=>'bootstrap.widgets.TBButtonColumn',
               'template' => '{edit} {posting} {print}',
               'buttons' => array(
							'edit' => array(
               				  //'visible'=>'$data->posting!=2',
							  'icon'=>false,
                              'url' => 'Yii::app()->createUrl("trxReceipt/update", array("no_receipt"=>$data->no_receipt))',
								'options'=>array(
								'class'=>'btn btn-small print'
								)
                           
                            ),
							'posting' => array(
               				  'visible'=>'$data->posting!=2',	
                              'url' => 'Yii::app()->createUrl("trxReceipt/posting", array("no_receipt"=>$data->no_receipt))',
								'options'=>array(
								'class'=>'btn btn-small print'
								)
                           
                            ),
							
                            'print' => array(
                              'url' => 'Yii::app()->createUrl("trxReceipt/cetak", array("nomor"=>$data->no_receipt))',
							  'type' => 'raw',
                              'options'=>array(
                                   'class'=>'btn btn-small print',
								   'target'=>'_blank'
                                   ),
								 ),   
							

               ),
            'htmlOptions'=>array('style'=>'width: 250px'),
           ),
	),
)); ?>